# -*-coding:utf-8-*-
import os

files = list()


def DirAll(pathName):
    if os.path.exists(pathName):
        fileList = os.listdir(pathName)
        for f in fileList:
            if f == "$RECYCLE.BIN" or f == "System Volume Information":
                continue
            f = os.path.join(pathName, f)
            if os.path.isdir(f):
                DirAll(f)
            else:
                dirName = os.path.dirname(f)
                baseName = os.path.basename(f)
                if baseName.endswith(".c"):
                    if dirName.endswith(os.sep):
                        files.append(dirName + baseName)
                    else:
                        files.append(dirName + os.sep + baseName)
        return files
    else:
        return 'FAIL'


if __name__ == "__main__":
    files = DirAll("..\\ldc70UnittestBench\\workspace\\")
    print(files)
